package com.ubb.smartsearch.classifier;
import java.io.IOException;

import com.ubb.smartsearch.classifier.naivebayes.NaiveBayesClassifierBean;
import com.ubb.smartsearch.classifier.rocchio.RocchioClassifierBean;
import com.ubb.smartsearch.classifier.tool.Utils;

public class Main {

	public static void main(String[] args) {
		try {
			String corpus = "20newsgroups";
			String source = "http://en.wikipedia.org/wiki/Motorcycle";
			// File testFile = new File(
			// "corpuses\\20newsgroups\\20news-bydate-train\\comp.sys.ibm.pc.hardware\\58831");

			ClassifierInterface rocchio = new RocchioClassifierBean();
			rocchio.setRocchioParameters(16, 4);
			rocchio.trainCategories(corpus);
			// rocchio.classifyDocument(Utils.readFile(testFile.getPath()));
			rocchio.classifyDocument(Utils.extractTextFromURL(source));

			ClassifierInterface bayes = new NaiveBayesClassifierBean();
			bayes.trainCategories(corpus);
			// bayes.classifyDocument(Utils.readFile(testFile.getPath()));
			bayes.classifyDocument(Utils.extractTextFromURL(source));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
